package com.qf.controller;

import com.qf.domain.EbookCategory;
import com.qf.service.EbookCategoryService;
import com.qf.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Date;
import java.util.List;
//@DateTimeFormat(pattern = "yyyy-MM-dd") 如果接收时间，那么需要转换格式输出的注解，用这个注解
@Controller
@ResponseBody   //这个就相当于跳过视图解析器，直接响应给客户端

//查询以后用get  增删改用post
@RequestMapping("/ebookcategory")  //设置访问路径
public class EbookCategoryController {
    @Autowired
    private EbookCategoryService ebookCategoryService;
    @GetMapping("/findall")
    public ResultVO category( ){
        List<EbookCategory> ecs=ebookCategoryService.findAll();
        ResultVO resultVO=new ResultVO();
        resultVO.setData(ecs);
        return resultVO;
    }
}
